//index.js
//获取应用实例
const app = getApp()

Page({
  data: {
    list: [
      {
        id: 'view',
        name: '视图容器',
        open: false,
        pages: ['view', 'scroll-view', 'swiper']
      }, 
       {
        id: 'form',
        name: '表单组件',
        open: false,
        pages: ['button', 'checkbox']
      }
    ]
  },

  kindToggle: function (e) {
    var id = e.currentTarget.id, list = this.data.list;
    for (var i = 0, len = list.length; i < len; ++i) {
      if (list[i].id == id) {
        list[i].open = !list[i].open
      } else {
        list[i].open = false
      }
    }
    this.setData({
      list: list
    });
  },

  //监听页面加载
  onLoad: function () {
    console.log("onLoad---------")
  },

  //监听也没初次渲染完成
  onReady: function () {
    console.log("onReady---------")
  },
  //监听也没显示，进入前台调用
  onShow: function () {
    console.log("onShow----------")
  },

  //监听页面隐藏
  onHide: function () {
    console.log("onHide----------")
  },

  //监听页面卸载
  onUnload: function () {
    console.log("onUnload---------")
  }
})
